package com.bio.dao;


import java.io.Serializable;

import javax.persistence.MappedSuperclass;

import org.hibernate.criterion.DetachedCriteria;

import com.bio.utils.Pager;
import com.bio.utils.Pagination;


/**
 * super class for the all data access objects.
 * @param <T> It is the entity(model) object.
 */
@MappedSuperclass
public interface Dao<T extends Serializable> {
	
	/**
	 * Inserts/Updates a entity object.
	 * @param obj
	 * @return
	 * @throws DaoException
	 */
    public T save(T obj) throws DaoException;
    
    /**
     * Deletes a entity object by ID.
     * @param id
     * @throws DaoException
     */
    public void remove(Serializable id) throws DaoException;
    
    /**
     * Gets a entity object by ID.
     * @param id
     * @return
     */
    public T get(Serializable id);
    
    /**
     * Gets all entity objects
     * @param <code>pagination</code>
     * @return
     */
    public Pager<T> findAllByPager(Pagination pagination);
    
    /**
     * Gets all entity objects
     * @param <code>pagination</code>
     * @return
     */
    public Pager<T> findAllByPagerNoCache(Pagination pagination);
    
    public int countByCriteria(DetachedCriteria criteria);
}
